close all
clear
clc
%% 20161006 data
data_r = zeros(8,7);
data_r = [30 21.8495 22.0772 20.6143 20.7758 20.8247
        35 17.9356 18.2190 17.0181 16.5944 16.9779
        40 14.2019 14.8211 13.9135 13.4279 14.1559
        45 11.6667 12.1277 11.5200 10.9819 11.5037
        50 9.1465 9.7204 9.1631 8.5662 9.3639
        55 7.0982 7.6660 7.3016 6.8629 7.4044
        60 5.4168 5.9476 5.5880 5.2296 5.7883
        65 4.4479 4.6988 4.6522 4.4142 4.7819];

data_r(:,7) = mean([data_r(:,2:6)],2);
curve_r = fit(data_r(:,7),data_r(:,1),'poly3')

data_b = zeros(8,7);
data_b = [30 20.9058 21.4827 20.4131 19.9851 20.2059
        35 17.5225 17.7268 16.7066 16.3085 16.6358
        40 14.0060 14.6424 13.7659 13.1145 13.8206
        45 11.3685 11.8871 11.2173 10.6857 11.2247
        50 9.0126 9.5921 8.9590 8.3911 9.1146
        55 6.9026 7.4671 6.9662 6.5026 7.1483
        60 5.5757 6.0180 5.9467 5.6429 6.1689  
        65 4.5073 4.6280 4.7677 4.5553 4.8157];

data_b(:,7) = mean([data_b(:,2:6)],2);
curve_b = fit(data_b(:,7),data_b(:,1),'poly3')



figure;
plot(curve_r)
hold on;
plot(curve_b)
plot(data_r(:,7),data_r(:,1),'r.','MarkerSize',20)
plot(data_b(:,7),data_b(:,1),'b.','MarkerSize',20)
xlabel('Standard Deviation (\sigma)'); ylabel('Depth (cm)');
title('Standard Deviation vs. Depth')
legend('Curve Fit Result','Measurement')
grid on
